import java.util.*;

public class Main {
    public static void main3(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int n = in.nextInt();
            int res = 0;
            while (n != 0) {
                if ((n & 1) == 1) {
                    res ++;
                }
                n >>= 1;
            }
            System.out.println(res);
        }
    }





    public static void main2(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
        }
        Arrays.sort(arr);
        System.out.println(find(arr, 0, 0, 1));
    }

    private static int find(int[] arr, int index, long sum, long multi) {
        int count = 0;
        for (int i = index; i < arr.length; i++) {
            sum = sum + arr[i];
            multi = multi * arr[i];
            if (sum > multi) {
                count += 1 + find(arr, i+1, sum, multi);
            } else if (sum == multi) {
                count += find(arr, i+1, sum, multi);
            } else {
                break;
            }

            sum -= arr[i];
            multi /= arr[i];

            while (i < arr.length-1 && arr[i] == arr[i+1]) {
                i++;
            }
        }
        return count;
    }




    // 计算日期到天数的转换
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        int year = in.nextInt();
        int month = in.nextInt();
        int day = in.nextInt();

        int res = 0;
        Map<Integer, Integer> map = initMap(year);
        for (int i = 1; i < month; i++) {
            res += map.get(i);
        }
        res += day;
        System.out.println(res);
    }

    private static boolean isLeapYear(int y) {
        return y % 4 == 0 && y % 100 != 0 || y % 400 == 0;
    }

    private static Map<Integer, Integer> initMap(int year) {
        Map<Integer, Integer> map = new HashMap<>();
        map.put(1, 31);
        map.put(2, 28);
        map.put(3, 31);
        map.put(4, 30);
        map.put(5, 31);
        map.put(6, 30);
        map.put(7, 31);
        map.put(8, 31);
        map.put(9, 30);
        map.put(10, 31);
        map.put(11, 30);
        map.put(12, 31);
        if (isLeapYear(year)) {
            map.put(2, 29);
        }
        return map;
    }
}
